package srjava.messages;

import java.io.IOException;
import java.io.StringReader;

public class ServerFullInfo extends ServerInfo {
	int numberOfTasks;

	public ServerFullInfo() {
		super();
		numberOfTasks = 0;
	}

	public ServerFullInfo(Address address, SrString name, int numberOfTasks) {
		super(address, name);
		this.numberOfTasks = numberOfTasks;
	}

	@Override
	public String serialize() {
		String s = super.serialize() + numberOfTasks + " ";
		return s;
	}

	@Override
	public void deSerialize(StringReader s) throws IOException {
		super.deSerialize(s);
		numberOfTasks = IntString.parseInt(s);
	}
	
	public static void main(String [ ] args)
	{
		ServerFullInfo in = new ServerFullInfo(new Address(new SrString("sdas"), 19), new SrString("moja ty jaskolko"), 5);
		System.out.println(in.serialize());
		try {
			in.deSerialize(new StringReader("4 sdas 17 16 moja ty jaskolko 0 4 "));
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		System.out.println(in.serialize());
	}

	public int getNumberOfTasks() {
		return numberOfTasks;
	}

	public void setNumberOfTasks(int numberOfTasks) {
		this.numberOfTasks = numberOfTasks;
	}
}
